package bod.gui.menu.items;

import java.awt.Graphics;

import bod.gui.ScreenListener;

public abstract class Item implements ScreenListener {

	protected String		name;
	protected int			x;
	protected int			y;
	protected int			width;
	protected int			height;
	protected ItemListener	listener;

	public Item(String name, int x, int y, int width, int height) {
		this.name = name;
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}

	public abstract void draw(Graphics g);

	public boolean contains(double x, double y) {
		return x >= this.x && x <= this.x + this.width && y >= this.y
				&& y <= this.y + this.height;
	}

	@Override
	public void keyPressed(int key) {
	}

	@Override
	public void keyReleased(int key) {
	}

	@Override
	public void mousePressed(int x, int y) {
	}

	@Override
	public void mouseReleased(int x, int y) {
	}

	@Override
	public void mouseMoved(int x, int y) {
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getX() {
		return this.x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return this.y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getWidth() {
		return this.width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return this.height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public void setListener(ItemListener listener) {
		this.listener = listener;
	}

}